<template>
  <div>
    <el-button @click="getUserById">根据Id查询用户</el-button>
    <p>{{ user }}</p>
  </div>
</template>


<script>
import userApi from "@/api/userApi";

export default {
  name: "C4AxiosView",
  data() {
    return {
      user: {
        username: undefined,
        password: undefined,
      },
    }
  },
  methods: {
    getUserById: function () {
      userApi.getUserById(1).then((res) => {
        this.user = res.data;
      }).catch((err) => {

      })
    }
  },
}
</script>

<style scoped>

</style>